// Create physics and renderer
var simulator = new Simulator();
var renderer = new Renderer();

// Create gui
var gui = new GuiVar(simulator, renderer);

renderer.getCanvas().onmousemove   = function(e) { gui.onMouseMove(e); }
renderer.getCanvas().onmousedown   = function(e) { gui.onMouseDown(e); }
renderer.getCanvas().onmouseup     = function(e) { gui.onMouseUp(e); }
renderer.getCanvas().ondblclick    = function(e) { gui.onDblClick(e); }
renderer.getCanvas().oncontextmenu = function()  { return false; }

document.getElementById("objectTypeLightSteel").onclick = function() { gui.setObjectType("lightSteel"); }
document.getElementById("objectTypeHeavySteel").onclick = function() { gui.setObjectType("heavySteel"); }
document.getElementById("objectTypeNode").onclick       = function() { gui.setObjectType("node"); }
document.getElementById("objectTypeBall").onclick       = function() { gui.setObjectType("ball"); }
document.getElementById("objectTypeFixedPoint").onclick = function() { gui.setObjectType("fixedPoint"); }

document.getElementById("simulationMode").onclick = function() { gui.startSimulation(); }
document.getElementById("editorMode").onclick = function() { gui.startEditor(); }
